<div class="app-container with-navbar with-tabbar" ng-controller="OrderDetailController">

    <div class="navbar fixed-top">
        <div class="navbar-left hide-weixin" ng-click="detailBack()">
            <img class="button-icon" ng-src="image/nav-left.png"/>
            <div class="button-text">返回</div>
        </div>
        <div class="navbar-title">
          订单详情
        </div>
    </div>

    <div class="app-content" ng-if="isLoaded">

        <!-- Status -->
        <div class="order-status" ng-if="order.status == 1">
            <img ng-src="image/icon-order-light.png">等待买家付款
        </div>
        <div class="order-status" ng-if="order.status == 2">
            <img ng-src="image/icon-order-light.png">交易取消
        </div>
        <div class="order-status" ng-if="order.type==1 && order.status==3">
            <img ng-src="image/icon-order-light.png">等待卖家发货
        </div>
        <div class="order-status" ng-if="order.type==2 && order.status==3">
            <img ng-src="image/icon-order-light.png">已付预付款
        </div>
        <div class="order-status" ng-if="order.status == 4">
            <img ng-src="image/icon-order-light.png">等待买家收货
        </div>
        <div class="order-status" ng-if="order.status == 5">
            <img ng-src="image/icon-order-light.png">交易成功,待评价
        </div>
        <div class="order-status" ng-if="order.status == 6">
            <img ng-src="image/icon-order-light.png">交易成功
        </div>
        <div class="order-status" ng-if="order.status == 7">
            <img ng-src="image/icon-order-light.png">已付尾款,等待卖家发货
        </div>

        <!-- Address -->
        <div class="order-address">
            <div class="address-contact">
                {{order.order_address.receiver_name}} {{order.order_address.mobile}}
            </div>
            <div class="address-detail">
                {{order.order_address.province}}
                {{order.order_address.city}}
                {{order.order_address.district}}
                {{order.order_address.full_address}}
            </div>
        </div>

        <!-- Goods -->
        <div class="order-goods">
            <div class="goods-item" ng-repeat="goods in order.order_goods track by $index">
                <div class="item-photo">
                    <img ng-src="image/default-photo.png" lazy-img="{{goods.cover_img}}" ng-click="touchProduct(order.type, goods.relation_id)"/>
                </div>
                <div class="item-info">
                    <div class="info-name">
                        {{goods.goods_name}}
                    </div>
                    <div class="info-price">
                        {{goods.price/100 | currency:"￥"}}
                    </div>
                    <div class="info-amount">
                        x{{goods.num}}
                    </div>
                </div>
            </div>
        </div>

        <!-- Total -->
        <div class="order-summury">
            <div class="summury-detail" ng-if="order.order_express">
                运费金额 <span class="total-price">+ {{order.order_express.express_fee| currency:"￥"}}</span>
            </div>
            <div class="summury-total">
                订单总价 <span class="total-price">= {{order.total_pay/100| currency:"￥"}}</span>
            </div>
        </div>

        <!-- Info -->
        <div class="order-info">
            <div class="info-text">
                订单编号：#{{order.order_sn}}
            </div>
            <div class="info-text">
                创建时间：{{order.created_at}}
            </div>
            <div class="info-text" ng-if="order.updated_at">
                更新时间：{{order.updated_at}}
            </div>
            <div ng-click="touchLive(order.order_pre_sale.pig_id)" ng-if="order.order_pre_sale && order.order_pre_sale.pig_id"
                 style="text-align: center;margin: 10px;height: 45px;line-height: 45px;background: #3eb94e;color: #ffffff;">
                观看土猪直播
            </div>
        </div>

        <!-- Dialog -->
        <div id="dialog" ng-show="showDialog">
            <div class="mask">
            </div>
            <div class="dialog danger">
                <div class="dialog-title">
                    确认取消
                </div>
                <div class="dialog-content">
                    是否取消该订单
                </div>
                <div class="dialog-button">
                    <div class="button left" ng-click="touchDialogCancel()">
                        取消
                    </div>
                    <div class="button right" ng-click="touchDialogConfirm()">
                        确认
                    </div>
                </div>
            </div>
        </div>

        <!-- Submit -->
        <div class="order-submit fixed-bottom">
            <div class="submit-button dark" ng-if="order.status == 1" ng-click="touchPay()">
                付款
            </div>
            <div class="submit-button dark" ng-if="order.type==2 && order.status==3" ng-click="touchPay()">
                付款尾款
            </div>
            <div class="submit-button" ng-if="order.status == 1" ng-click="touchCancel()">
                取消订单
            </div>
            <div class="submit-button dark" ng-if="order.status == 4" ng-click="touchConfirm()">
                确认收货
            </div>
            <div class="submit-button dark" ng-if="order.status == 5" ng-click="touchComment()">
                评价
            </div>
            <div class="submit-button" ng-if="order.status==4 || order.status==5 || order.status==6" ng-click="touchExpress()">
                查看物流
            </div>
        </div>

    </div>

</div>
